/****************************** (C) COPYRIGHT 2016 Rsestudio ************************
* File Name          : 
* Author             : Rsestudio
* Version            : V1.0.0
* Date               : 01-MAR-2024
* Description        : 
*****************************************************************************************/

#ifndef __DEVICE_PINS_H__
#define __DEVICE_PINS_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ----------------------------------------------------------------------------*/
#include "driver/gpio.h"
/* Exported define ---------------------------------------------------------------------*/
#if DEV_TYPE == DEV_TYPE_I7

/* 引脚定义 */
#define LED0_GPIO_PIN    GPIO_NUM_1     /* LED0连接的GPIO端口 */

// Key
//power PB7
#define KEY_POWER_STS()	        gpio_get_level(GPIO_NUM_33)//(GPIOB->IDR&GPIO_PIN_7)

//run_UP PA7
#define KEY_UP_PLAY_STS()       gpio_get_level(GPIO_NUM_34)//(GPIOB->IDR&GPIO_PIN_8)
//down 
#define KEY_DOWN_STS()	        gpio_get_level(GPIO_NUM_35)//(GPIOB->IDR&GPIO_PIN_6)

//BUS_link PA5
#define BUS_LINK_STS()	        0//(GPIOA->IDR&GPIO_PIN_5)

//Charge status
#define CHARGE_STS()            0//(GPIOA->IDR&GPIO_PIN_3)

//SYS_POWER_ON
#define SYS_POWER_ON()	        1//GPIOA->BSRR = GPIO_PIN_4
#define SYS_POWER_OFF()	        0//GPIOA->BSRR = GPIO_PIN_4<<16

// WIFI
#define WL_POWER_ON()	        1//GPIOB->BSRR = GPIO_PIN_3
#define WL_POWER_OFF()          0//GPIOB->BSRR = GPIO_PIN_3<<16

//LCD
#define OLED_CS_Clr()           //gpio_set_level(GPIO_NUM_17, 0);//GPIOC->BSRR = GPIO_PIN_2<<16
#define OLED_CS_Set()           //gpio_set_level(GPIO_NUM_17, 1);//GPIOC->BSRR = GPIO_PIN_2
//
#define OLED_SCL_Clr()          //gpio_set_level(GPIO_NUM_18, 0);//GPIOC->BSRR = GPIO_PIN_3<<16
#define OLED_SCL_Set()          //gpio_set_level(GPIO_NUM_18, 1);//GPIOC->BSRR = GPIO_PIN_3
//
#define OLED_SDA_Clr()          //gpio_set_level(GPIO_NUM_19, 0);//GPIOA->BSRR = GPIO_PIN_2<<16
#define OLED_SDA_Set()          //gpio_set_level(GPIO_NUM_19, 1);//GPIOA->BSRR = GPIO_PIN_2
//
#define OLED_DC_Clr()           //gpio_set_level(GPIO_NUM_20, 0);//GPIOA->BSRR = GPIO_PIN_1<<16
#define OLED_DC_Set()           //gpio_set_level(GPIO_NUM_20, 1);//GPIOA->BSRR = GPIO_PIN_1
//
#define OLED_RES_Clr()          //gpio_set_level(GPIO_NUM_21, 0);//GPIOA->BSRR = GPIO_PIN_0<<16
#define OLED_RES_Set()          //gpio_set_level(GPIO_NUM_21, 1);//GPIOA->BSRR = GPIO_PIN_0

//LED
#define LED_RUN_B_ON()			do{}while(0)
#define LED_RUN_B_OFF()			do{}while(0)

#define LED_RUN_G_ON()			do{}while(0)
#define LED_RUN_G_OFF()			do{}while(0)
    
#define LED_RUN_R_ON()			do{}while(0)
#define LED_RUN_R_OFF()			do{}while(0)

#define LED_SYS_R_ON()			do{}while(0)
#define LED_SYS_R_OFF()			do{}while(0)

#define LED_SYS_G_ON()			do{}while(0)
#define LED_SYS_G_OFF()			do{}while(0)

#define LED_BLE_B_ON()			do{}while(0)
#define LED_BLE_B_OFF()			do{}while(0)
    
#define LED_BLE_R_ON()			do{}while(0)
#define LED_BLE_R_OFF()			do{}while(0)

//PUMP_CTL
#define PUMP_ON()               do{}while(0)
#define PUMP_OFF()              do{}while(0)

//HEAT_SW
#define HEAT_ON()               do{}while(0)
#define HEAT_OFF()              do{}while(0)


//SPI - memory
//CS
#define W25X_CS_H()            gpio_set_level(GPIO_NUM_10, 1); //GPIOB->BSRR = GPIO_PIN_12
#define W25X_CS_L()            gpio_set_level(GPIO_NUM_10, 0); //GPIOB->BSRR = GPIO_PIN_12<<16

//MEAS spi
#define ADS_CS_1_H()           gpio_set_level(GPIO_NUM_1, 1); //GPIOC->BSRR = GPIO_PIN_11
#define ADS_CS_1_L()           gpio_set_level(GPIO_NUM_1, 0); //GPIOC->BSRR = GPIO_PIN_11<<16

#define ADS_CS_2_H()           gpio_set_level(GPIO_NUM_2, 1); //GPIOC->BSRR = GPIO_PIN_12
#define ADS_CS_2_L()           gpio_set_level(GPIO_NUM_2, 0); //GPIOC->BSRR = GPIO_PIN_12<<16

#define ADS_CS_3_H()           gpio_set_level(GPIO_NUM_3, 1); //GPIOC->BSRR = GPIO_PIN_10
#define ADS_CS_3_L()           gpio_set_level(GPIO_NUM_3, 0); //GPIOC->BSRR = GPIO_PIN_10<<16

#define ADS_CS_4_H()           gpio_set_level(GPIO_NUM_4, 1); //GPIOA->BSRR = GPIO_PIN_15
#define ADS_CS_4_L()           gpio_set_level(GPIO_NUM_4, 0); //GPIOA->BSRR = GPIO_PIN_15<<16
    
#define ADS_CS_5_H()           gpio_set_level(GPIO_NUM_5, 1); //GPIOC->BSRR = GPIO_PIN_7
#define ADS_CS_5_L()           gpio_set_level(GPIO_NUM_5, 0); //GPIOC->BSRR = GPIO_PIN_7<<16

#define ADS_CS_6_H()           gpio_set_level(GPIO_NUM_6, 1); //GPIOC->BSRR = GPIO_PIN_6
#define ADS_CS_6_L()           gpio_set_level(GPIO_NUM_6, 0); //GPIOC->BSRR = GPIO_PIN_6<<16

#define ADS_CS_7_H()           gpio_set_level(GPIO_NUM_7, 1); //GPIOB->BSRR = GPIO_PIN_1
#define ADS_CS_7_L()           gpio_set_level(GPIO_NUM_7, 0); //GPIOB->BSRR = GPIO_PIN_1<<16

#define ADS_CS_8_H()           gpio_set_level(GPIO_NUM_8, 1); //GPIOB->BSRR = GPIO_PIN_2
#define ADS_CS_8_L()           gpio_set_level(GPIO_NUM_8, 0); //GPIOB->BSRR = GPIO_PIN_2<<16

//MEAS spi
//CS_SEN 
#define SEN_CS_H()              while(0);
#define SEN_CS_L()              while(0);

//CS_ACC
#define ACC_CS_H()              gpio_set_level(GPIO_NUM_9, 1); //GPIOD->BSRR = GPIO_PIN_2
#define ACC_CS_L()              gpio_set_level(GPIO_NUM_9, 0); //GPIOD->BSRR = GPIO_PIN_2<<16

//SCLK 
#define ADS_SCLK_H()            gpio_set_level(GPIO_NUM_14, 1); //GPIOA->BSRR = GPIO_PIN_8
#define ADS_SCLK_L()            gpio_set_level(GPIO_NUM_14, 0); //GPIOA->BSRR = GPIO_PIN_8<<16
//MOSI 
#define ADS_MOSI_H()            gpio_set_level(GPIO_NUM_15, 1); //GPIOC->BSRR = GPIO_PIN_9
#define ADS_MOSI_L()            gpio_set_level(GPIO_NUM_15, 0); //GPIOC->BSRR = GPIO_PIN_9<<16
//MISO 
#define ADS_MISO()              gpio_get_level(GPIO_NUM_16) //(GPIOC->IDR&GPIO_PIN_8)


//PM
#define PM_SCL_H()              //GPIOA->BSRR = GPIO_PIN_6
#define PM_SCL_L()              //GPIOA->BSRR = GPIO_PIN_6<<16

#define PM_SDA_H()              //GPIOA->BSRR = GPIO_PIN_7
#define PM_SDA_L()              //GPIOA->BSRR = GPIO_PIN_7<<16
#define PM_SDA_STS()		    //(GPIOA->IDR&GPIO_PIN_7)

#define PM_SDA_IN()             PM_SDA_H()
#define PM_SDA_OUT()            do{}while(0)
    
//SEN
#define SEN_SCL_H()             gpio_set_level(GPIO_NUM_41, 1); //GPIOA->BSRR = GPIO_PIN_10
#define SEN_SCL_L()             gpio_set_level(GPIO_NUM_41, 0); //GPIOA->BSRR = GPIO_PIN_10<<16

#define SEN_SDA_H()             gpio_set_level(GPIO_NUM_42, 1); //GPIOA->BSRR = GPIO_PIN_9
#define SEN_SDA_L()             gpio_set_level(GPIO_NUM_42, 0); //GPIOA->BSRR = GPIO_PIN_9<<16
#define SEN_SDA_STS()		    gpio_get_level(GPIO_NUM_42)    //(GPIOA->IDR&GPIO_PIN_9)

#define SEN_SDA_IN()             SEN_SDA_H()
#define SEN_SDA_OUT()            do{}while(0)
    
//LED
#define LED_RUN_B_ON()			do{}while(0)
#define LED_RUN_B_OFF()			do{}while(0)

#define LED_RUN_G_ON()			do{}while(0)
#define LED_RUN_G_OFF()			do{}while(0)
    
#define LED_RUN_R_ON()			do{}while(0)
#define LED_RUN_R_OFF()			do{}while(0)

#define LED_SYS_R_ON()			do{}while(0)
#define LED_SYS_R_OFF()			do{}while(0)

#define LED_SYS_G_ON()			do{}while(0)
#define LED_SYS_G_OFF()			do{}while(0)

#define LED_BLE_B_ON()			do{}while(0)
#define LED_BLE_B_OFF()			do{}while(0)
    
#define LED_BLE_R_ON()			do{}while(0)
#define LED_BLE_R_OFF()			do{}while(0)

//PUMP_CTL
#define PUMP_ON()               do{}while(0)
#define PUMP_OFF()              do{}while(0)

//HEAT_SW
#define HEAT_ON()               do{}while(0)
#define HEAT_OFF()              do{}while(0)


//SENSOR_BIAS_SW
#define SENSOR_BIAS_ON()        do{}while(0)
#define SENSOR_BIAS_OFF()       do{}while(0)

//SENSOR_BIAS_SEL
#define SENSOR_BIAS_High()      do{}while(0)
#define SENSOR_BIAS_Low()       do{}while(0)
    

//LS
#define LS_SCL_H()              while(0);
#define LS_SCL_L()              while(0);

#define LS_SDA_1_H()            do{}while(0)
#define LS_SDA_1_L()            do{}while(0)
#define LS_SDA_1_STS()		    0
#define LS_SDA_1_IN()           while(0);
#define LS_SDA_1_OUT()          while(0);

#define LS_SDA_2_H()            do{}while(0)
#define LS_SDA_2_L()            do{}while(0)
#define LS_SDA_2_STS()		    0
#define LS_SDA_2_IN()           while(0);
#define LS_SDA_2_OUT()          while(0);

#define PS_SCL_L()     			while(0);
#define PS_SCL_H()     			while(0);

#define PS0_SDA_IN     			while(0);
#define PS0_SDA_OUT    			while(0);
#define PS0_SDA_L()    			while(0);
#define PS0_SDA_H()    			while(0);
#define PS0_SDA()      			0

//EPROM PB6
#define EPROM_H()               while(0);
#define EPROM_L()               while(0);
#define EPROM_IN()              while(0);
#define EPROM_OUT()             while(0);

//ENC
//ENC_CS
#define ENC_CS_H()              while(0);
#define ENC_CS_L()              while(0);

//ENC_CLK 
#define ENC_SCLK_H()            while(0);
#define ENC_SCLK_L()            while(0);

//ENC_DO
#define ENC_MISO()				0



#elif DEV_TYPE == DEV_TYPE_XP 

// Key
//power PB7
#define KEY_POWER_STS()			(GPIOB->IDR&GPIO_PIN_7)

//run_UP PA7
#define KEY_UP_PLAY_STS()		(GPIOB->IDR&GPIO_PIN_8)
//down 
#define KEY_DOWN_STS()			(GPIOB->IDR&GPIO_PIN_6)

//BUS_link PA4
#define BUS_LINK_STS()			(GPIOA->IDR&GPIO_PIN_5)

//Charge status
#define CHARGE_STS()            (GPIOA->IDR&GPIO_PIN_3)

//SYS_POWER_ON
#define SYS_POWER_ON()			GPIOA->BSRR = GPIO_PIN_4
#define SYS_POWER_OFF()			GPIOA->BSRR = GPIO_PIN_4<<16

//WL_POWER_ON
#define WL_POWER_ON()			GPIOB->BSRR = GPIO_PIN_3
#define WL_POWER_OFF()			GPIOB->BSRR = GPIO_PIN_3<<16

//LCD
#define OLED_SCL_Clr()          do{}while(0)
#define OLED_SCL_Set()          do{}while(0)

#define OLED_SDA_Clr()          do{}while(0)
#define OLED_SDA_Set()          do{}while(0)

#define OLED_RES_Clr()          do{}while(0)
#define OLED_RES_Set()          do{}while(0)

#define OLED_DC_Clr()           do{}while(0)
#define OLED_DC_Set()           do{}while(0)
 		     
#define OLED_CS_Clr()           do{}while(0)
#define OLED_CS_Set()           do{}while(0)

//LED
#define LED_RUN_B_ON()			do{}while(0)    //none
#define LED_RUN_B_OFF()			do{}while(0)    //none

#define LED_RUN_G_ON()			GPIOC->BSRR = GPIO_PIN_2<<16    //CS
#define LED_RUN_G_OFF()			GPIOC->BSRR = GPIO_PIN_2      
    
#define LED_RUN_R_ON()			GPIOC->BSRR = GPIO_PIN_3<<16    //SCL
#define LED_RUN_R_OFF()			GPIOC->BSRR = GPIO_PIN_3

#define LED_SYS_R_ON()			GPIOA->BSRR = GPIO_PIN_1<<16  //DC
#define LED_SYS_R_OFF()			GPIOA->BSRR = GPIO_PIN_1

#define LED_SYS_G_ON()			GPIOA->BSRR = GPIO_PIN_2<<16    //SDA
#define LED_SYS_G_OFF()			GPIOA->BSRR = GPIO_PIN_2

#define LED_BLE_B_ON()			GPIOA->BSRR = GPIO_PIN_0<<16    //RES
#define LED_BLE_B_OFF()			GPIOA->BSRR = GPIO_PIN_0
    
#define LED_BLE_R_ON()			do{}while(0)    //none
#define LED_BLE_R_OFF()			do{}while(0)    //none

//PUMP_CTL
#define PUMP_ON()               do{}while(0)
#define PUMP_OFF()              do{}while(0)

//HEAT_SW
#define HEAT_ON()               do{}while(0)
#define HEAT_OFF()              do{}while(0)


//SPI - memory
//CS
#define W25X_CS_H()             GPIOB->BSRR = GPIO_PIN_12
#define W25X_CS_L()             GPIOB->BSRR = GPIO_PIN_12<<16

//MEAS spi
#define ADS_CS_1_H()            GPIOC->BSRR = GPIO_PIN_11
#define ADS_CS_1_L()            GPIOC->BSRR = GPIO_PIN_11<<16

#define ADS_CS_2_H()           	GPIOC->BSRR = GPIO_PIN_12
#define ADS_CS_2_L()            GPIOC->BSRR = GPIO_PIN_12<<16

#define ADS_CS_3_H()            GPIOC->BSRR = GPIO_PIN_10
#define ADS_CS_3_L()            GPIOC->BSRR = GPIO_PIN_10<<16

#define ADS_CS_4_H()            GPIOA->BSRR = GPIO_PIN_15
#define ADS_CS_4_L()            GPIOA->BSRR = GPIO_PIN_15<<16
    
#define ADS_CS_5_H()            GPIOC->BSRR = GPIO_PIN_7
#define ADS_CS_5_L()            GPIOC->BSRR = GPIO_PIN_7<<16

#define ADS_CS_6_H()           	GPIOC->BSRR = GPIO_PIN_6
#define ADS_CS_6_L()            GPIOC->BSRR = GPIO_PIN_6<<16

#define ADS_CS_7_H()            GPIOB->BSRR = GPIO_PIN_1
#define ADS_CS_7_L()            GPIOB->BSRR = GPIO_PIN_1<<16

#define ADS_CS_8_H()            GPIOB->BSRR = GPIO_PIN_2
#define ADS_CS_8_L()            GPIOB->BSRR = GPIO_PIN_2<<16

//MEAS spi
//CS_SEN 
#define SEN_CS_H()              while(0);
#define SEN_CS_L()              while(0);

//CS_ACC
#define ACC_CS_H()              GPIOD->BSRR = GPIO_PIN_2
#define ACC_CS_L()              GPIOD->BSRR = GPIO_PIN_2<<16

//SCLK 
#define ADS_SCLK_H()            GPIOA->BSRR = GPIO_PIN_8
#define ADS_SCLK_L()            GPIOA->BSRR = GPIO_PIN_8<<16
//MOSI 
#define ADS_MOSI_H()            GPIOC->BSRR = GPIO_PIN_9
#define ADS_MOSI_L()            GPIOC->BSRR = GPIO_PIN_9<<16
//MISO 
#define ADS_MISO()				(GPIOC->IDR&GPIO_PIN_8)


//PM
#define PM_SCL_H()              GPIOA->BSRR = GPIO_PIN_6
#define PM_SCL_L()              GPIOA->BSRR = GPIO_PIN_6<<16

#define PM_SDA_H()              GPIOA->BSRR = GPIO_PIN_7
#define PM_SDA_L()              GPIOA->BSRR = GPIO_PIN_7<<16
#define PM_SDA_STS()		    (GPIOA->IDR&GPIO_PIN_7)

#define PM_SDA_IN()             PM_SDA_H()
#define PM_SDA_OUT()            do{}while(0)
    
//SEN
#define SEN_SCL_H()              GPIOA->BSRR = GPIO_PIN_10
#define SEN_SCL_L()              GPIOA->BSRR = GPIO_PIN_10<<16

#define SEN_SDA_H()              GPIOA->BSRR = GPIO_PIN_9
#define SEN_SDA_L()              GPIOA->BSRR = GPIO_PIN_9<<16
#define SEN_SDA_STS()		    (GPIOA->IDR&GPIO_PIN_9)

#define SEN_SDA_IN()             SEN_SDA_H()
#define SEN_SDA_OUT()            do{}while(0)
    


//PUMP_CTL
#define PUMP_ON()               do{}while(0)
#define PUMP_OFF()              do{}while(0)

//HEAT_SW
#define HEAT_ON()               do{}while(0)
#define HEAT_OFF()              do{}while(0)


//SENSOR_BIAS_SW
#define SENSOR_BIAS_ON()        do{}while(0)
#define SENSOR_BIAS_OFF()       do{}while(0)

//SENSOR_BIAS_SEL
#define SENSOR_BIAS_High()      do{}while(0)
#define SENSOR_BIAS_Low()       do{}while(0)
    

//LS
#define LS_SCL_H()              while(0);
#define LS_SCL_L()              while(0);

#define LS_SDA_1_H()            do{}while(0)
#define LS_SDA_1_L()            do{}while(0)
#define LS_SDA_1_STS()		    0
#define LS_SDA_1_IN()           while(0);
#define LS_SDA_1_OUT()          while(0);

#define LS_SDA_2_H()            do{}while(0)
#define LS_SDA_2_L()            do{}while(0)
#define LS_SDA_2_STS()		    0
#define LS_SDA_2_IN()           while(0);
#define LS_SDA_2_OUT()          while(0);

#define PS_SCL_L()     			SEN_SCL_L()
#define PS_SCL_H()     			SEN_SCL_H()

#define PS0_SDA_IN     			SEN_SDA_IN()
#define PS0_SDA_OUT    			SEN_SDA_OUT()
#define PS0_SDA_L()    			SEN_SDA_L()
#define PS0_SDA_H()    			SEN_SDA_H()
#define PS0_SDA()      			SEN_SDA_STS()

//EPROM PB6
#define EPROM_H()               while(0);
#define EPROM_L()               while(0);
#define EPROM_IN()              while(0);
#define EPROM_OUT()             while(0);

//ENC
//ENC_CS
#define ENC_CS_H()              while(0);
#define ENC_CS_L()              while(0);

//ENC_CLK 
#define ENC_SCLK_H()            while(0);
#define ENC_SCLK_L()            while(0);

//ENC_DO
#define ENC_MISO()				0


#elif DEV_TYPE == DEV_TYPE_MINI

// Key
//power PA15
#define KEY_POWER_STS()			(GPIOA->IDR&GPIO_PIN_15)

//run_UP PB6
#define KEY_UP_PLAY_STS()		(GPIOB->IDR&GPIO_PIN_6)
//down 
#define KEY_DOWN_STS()			0

//BUS_link PB7
#define BUS_LINK_STS()			(GPIOB->IDR&GPIO_PIN_7)

//Charge status PB8
#define CHARGE_STS()            (GPIOB->IDR&GPIO_PIN_8)

//SYS_POWER_ON
#define SYS_POWER_ON()			GPIOB->BSRR = GPIO_PIN_9
#define SYS_POWER_OFF()			GPIOB->BSRR = GPIO_PIN_9<<16

//WL_POWER_ON
#define WL_POWER_ON()			do{}while(0)
#define WL_POWER_OFF()			do{}while(0)

//LCD
#define OLED_SCL_Clr()          do{}while(0)
#define OLED_SCL_Set()          do{}while(0)

#define OLED_SDA_Clr()          do{}while(0)
#define OLED_SDA_Set()          do{}while(0)

#define OLED_RES_Clr()          do{}while(0)
#define OLED_RES_Set()          do{}while(0)

#define OLED_DC_Clr()           do{}while(0)
#define OLED_DC_Set()           do{}while(0)
 		     
#define OLED_CS_Clr()           do{}while(0)
#define OLED_CS_Set()           do{}while(0)

//LED
#define LED_RUN_B_ON()			do{}while(0)    //none
#define LED_RUN_B_OFF()			do{}while(0)    //none

#define LED_RUN_G_ON()			GPIOA->BSRR = GPIO_PIN_4<<16    //CS
#define LED_RUN_G_OFF()			GPIOA->BSRR = GPIO_PIN_4      
    
#define LED_RUN_R_ON()			GPIOA->BSRR = GPIO_PIN_3<<16    //SCL
#define LED_RUN_R_OFF()			GPIOA->BSRR = GPIO_PIN_3

#define LED_SYS_R_ON()			GPIOA->BSRR = GPIO_PIN_1<<16  //DC
#define LED_SYS_R_OFF()			GPIOA->BSRR = GPIO_PIN_1

#define LED_SYS_G_ON()			GPIOA->BSRR = GPIO_PIN_2<<16    //SDA
#define LED_SYS_G_OFF()			GPIOA->BSRR = GPIO_PIN_2

#define LED_BLE_B_ON()			do{}while(0)    //none
#define LED_BLE_B_OFF()			do{}while(0)    //none
    
#define LED_BLE_R_ON()			do{}while(0)    //none
#define LED_BLE_R_OFF()			do{}while(0)    //none

//PUMP_CTL
#define PUMP_ON()               do{}while(0)
#define PUMP_OFF()              do{}while(0)

//HEAT_SW
#define HEAT_ON()               do{}while(0)
#define HEAT_OFF()              do{}while(0)


//SPI - memory
//CS
#define W25X_CS_H()             GPIOB->BSRR = GPIO_PIN_12
#define W25X_CS_L()             GPIOB->BSRR = GPIO_PIN_12<<16

//MEAS spi
#define ADS_CS_1_H()            GPIOB->BSRR = GPIO_PIN_2
#define ADS_CS_1_L()            GPIOB->BSRR = GPIO_PIN_2<<16

#define ADS_CS_2_H()           	do{}while(0)
#define ADS_CS_2_L()            do{}while(0)

#define ADS_CS_3_H()            do{}while(0)
#define ADS_CS_3_L()            do{}while(0)

#define ADS_CS_4_H()            do{}while(0)
#define ADS_CS_4_L()            do{}while(0)
    
#define ADS_CS_5_H()            do{}while(0)
#define ADS_CS_5_L()            do{}while(0)

#define ADS_CS_6_H()           	do{}while(0)
#define ADS_CS_6_L()            do{}while(0)

#define ADS_CS_7_H()            do{}while(0)
#define ADS_CS_7_L()            do{}while(0)

#define ADS_CS_8_H()            do{}while(0)
#define ADS_CS_8_L()            do{}while(0)

//MEAS spi
//CS_SEN 
#define SEN_CS_H()              while(0);
#define SEN_CS_L()              while(0);

//CS_ACC
#define ACC_CS_H()              GPIOA->BSRR = GPIO_PIN_6
#define ACC_CS_L()              GPIOA->BSRR = GPIO_PIN_6<<16

//SCLK 
#define ADS_SCLK_H()            GPIOB->BSRR = GPIO_PIN_1
#define ADS_SCLK_L()            GPIOB->BSRR = GPIO_PIN_1<<16
//MOSI 
#define ADS_MOSI_H()            GPIOB->BSRR = GPIO_PIN_0
#define ADS_MOSI_L()            GPIOB->BSRR = GPIO_PIN_0<<16
//MISO 
#define ADS_MISO()				(GPIOA->IDR&GPIO_PIN_7)


//PM
#define PM_SCL_H()              GPIOB->BSRR = GPIO_PIN_4
#define PM_SCL_L()              GPIOB->BSRR = GPIO_PIN_4<<16

#define PM_SDA_H()              GPIOB->BSRR = GPIO_PIN_3
#define PM_SDA_L()              GPIOB->BSRR = GPIO_PIN_3<<16
#define PM_SDA_STS()		    (GPIOB->IDR&GPIO_PIN_3)

#define PM_SDA_IN()             PM_SDA_H()
#define PM_SDA_OUT()            do{}while(0)
    
//SEN
#define SEN_SCL_H()              do{}while(0)
#define SEN_SCL_L()              do{}while(0)

#define SEN_SDA_H()              do{}while(0)
#define SEN_SDA_L()              do{}while(0)
#define SEN_SDA_STS()		    0

#define SEN_SDA_IN()             do{}while(0)
#define SEN_SDA_OUT()            do{}while(0)
    

#define SEN_DQ_H()              GPIOA->BSRR = GPIO_PIN_5
#define SEN_DQ_L()              GPIOA->BSRR = GPIO_PIN_5<<16
#define SEN_DQ_STS()		    (GPIOA->IDR&GPIO_PIN_5)

#define SEN_DQ_IN()             SEN_DQ_H()
#define SEN_DQ_OUT()            do{}while(0)  


//PUMP_CTL
#define PUMP_ON()               do{}while(0)
#define PUMP_OFF()              do{}while(0)

//HEAT_SW
#define HEAT_ON()               do{}while(0)
#define HEAT_OFF()              do{}while(0)


//SENSOR_BIAS_SW
#define SENSOR_BIAS_ON()        do{}while(0)
#define SENSOR_BIAS_OFF()       do{}while(0)

//SENSOR_BIAS_SEL
#define SENSOR_BIAS_High()      do{}while(0)
#define SENSOR_BIAS_Low()       do{}while(0)
    

//LS
#define LS_SCL_H()              while(0);
#define LS_SCL_L()              while(0);

#define LS_SDA_1_H()            do{}while(0)
#define LS_SDA_1_L()            do{}while(0)
#define LS_SDA_1_STS()		    0
#define LS_SDA_1_IN()           while(0);
#define LS_SDA_1_OUT()          while(0);

#define LS_SDA_2_H()            do{}while(0)
#define LS_SDA_2_L()            do{}while(0)
#define LS_SDA_2_STS()		    0
#define LS_SDA_2_IN()           while(0);
#define LS_SDA_2_OUT()          while(0);

#define PS_SCL_L()     			do{}while(0)
#define PS_SCL_H()     			do{}while(0)

#define PS0_SDA_IN()     	    do{}while(0)
#define PS0_SDA_OUT()    		do{}while(0)
#define PS0_SDA_L()    			do{}while(0)
#define PS0_SDA_H()    			do{}while(0)
#define PS0_SDA()      			SEN_SDA_STS()

//EPROM PB6
#define EPROM_H()               while(0);
#define EPROM_L()               while(0);
#define EPROM_IN()              while(0);
#define EPROM_OUT()             while(0);

//ENC
//ENC_CS
#define ENC_CS_H()              while(0);
#define ENC_CS_L()              while(0);

//ENC_CLK 
#define ENC_SCLK_H()            while(0);
#define ENC_SCLK_L()            while(0);

//ENC_DO
#define ENC_MISO()				0

#elif DEV_TYPE == DEV_TYPE_VACUUM

// Key
//power PB7
#define KEY_POWER_STS()			(GPIOB->IDR&GPIO_PIN_7)

//run_UP PB8
#define KEY_UP_PLAY_STS()		0
//down 
#define KEY_DOWN_STS()			0

//BUS_link PA4
#define BUS_LINK_STS()			(GPIOA->IDR&GPIO_PIN_5)

//Charge status
#define CHARGE_STS()            (GPIOA->IDR&GPIO_PIN_3)

//SYS_POWER_ON
#define SYS_POWER_ON()			GPIOA->BSRR = GPIO_PIN_4
#define SYS_POWER_OFF()			GPIOA->BSRR = GPIO_PIN_4<<16

//WL_POWER_ON
#define WL_POWER_ON()			GPIOB->BSRR = GPIO_PIN_3
#define WL_POWER_OFF()			GPIOB->BSRR = GPIO_PIN_3<<16

//LCD
#define OLED_SCL_Clr()          do{}while(0)
#define OLED_SCL_Set()          do{}while(0)

#define OLED_SDA_Clr()          do{}while(0)
#define OLED_SDA_Set()          do{}while(0)

#define OLED_RES_Clr()          do{}while(0)
#define OLED_RES_Set()          do{}while(0)

#define OLED_DC_Clr()           do{}while(0)
#define OLED_DC_Set()           do{}while(0)
 		     
#define OLED_CS_Clr()           do{}while(0)
#define OLED_CS_Set()           do{}while(0)

//LED
#define LED_RUN_B_ON()			do{}while(0)    //none
#define LED_RUN_B_OFF()			do{}while(0)    //none
//PC7
#define LED_RUN_G_ON()			GPIOC->BSRR = GPIO_PIN_7<<16    
#define LED_RUN_G_OFF()			GPIOC->BSRR = GPIO_PIN_7      
//PB6  
#define LED_RUN_R_ON()			GPIOB->BSRR = GPIO_PIN_6<<16    
#define LED_RUN_R_OFF()			GPIOB->BSRR = GPIO_PIN_6
//PB5
#define LED_SYS_R_ON()			GPIOB->BSRR = GPIO_PIN_5<<16 
#define LED_SYS_R_OFF()			GPIOB->BSRR = GPIO_PIN_5
//PB9
#define LED_SYS_G_ON()			GPIOB->BSRR = GPIO_PIN_9<<16  
#define LED_SYS_G_OFF()			GPIOB->BSRR = GPIO_PIN_9

#define LED_BLE_B_ON()			do{}while(0)    //none
#define LED_BLE_B_OFF()			do{}while(0)    //none
    
#define LED_BLE_R_ON()			do{}while(0)    //none
#define LED_BLE_R_OFF()			do{}while(0)    //none

//PUMP_CTL
#define PUMP_ON()               do{}while(0)
#define PUMP_OFF()              do{}while(0)

//HEAT_SW
#define HEAT_ON()               do{}while(0)
#define HEAT_OFF()              do{}while(0)


//SPI - memory
//CS
#define W25X_CS_H()             GPIOB->BSRR = GPIO_PIN_12
#define W25X_CS_L()             GPIOB->BSRR = GPIO_PIN_12<<16

//MEAS spi
#define ADS_CS_1_H()            GPIOC->BSRR = GPIO_PIN_12
#define ADS_CS_1_L()            GPIOC->BSRR = GPIO_PIN_12<<16

#define ADS_CS_2_H()           	GPIOA->BSRR = GPIO_PIN_15
#define ADS_CS_2_L()            GPIOA->BSRR = GPIO_PIN_15<<16

#define ADS_CS_3_H()            GPIOC->BSRR = GPIO_PIN_6
#define ADS_CS_3_L()            GPIOC->BSRR = GPIO_PIN_6<<16

#define ADS_CS_4_H()            GPIOB->BSRR = GPIO_PIN_2
#define ADS_CS_4_L()            GPIOB->BSRR = GPIO_PIN_2<<16
    
#define ADS_CS_5_H()            while(0);
#define ADS_CS_5_L()            while(0);

#define ADS_CS_6_H()           	while(0);
#define ADS_CS_6_L()            while(0);

#define ADS_CS_7_H()            while(0);
#define ADS_CS_7_L()            while(0);

#define ADS_CS_8_H()            while(0);
#define ADS_CS_8_L()            while(0);

//MEAS spi
//CS_SEN 
#define SEN_CS_H()              while(0);
#define SEN_CS_L()              while(0);

//CS_ACC
#define ACC_CS_H()              GPIOD->BSRR = GPIO_PIN_2
#define ACC_CS_L()              GPIOD->BSRR = GPIO_PIN_2<<16

//SCLK 
#define ADS_SCLK_H()            GPIOA->BSRR = GPIO_PIN_8
#define ADS_SCLK_L()            GPIOA->BSRR = GPIO_PIN_8<<16
//MOSI 
#define ADS_MOSI_H()            GPIOC->BSRR = GPIO_PIN_9
#define ADS_MOSI_L()            GPIOC->BSRR = GPIO_PIN_9<<16
//MISO 
#define ADS_MISO()				(GPIOC->IDR&GPIO_PIN_8)


//PM
#define PM_SCL_H()              GPIOA->BSRR = GPIO_PIN_6
#define PM_SCL_L()              GPIOA->BSRR = GPIO_PIN_6<<16

#define PM_SDA_H()              GPIOA->BSRR = GPIO_PIN_7
#define PM_SDA_L()              GPIOA->BSRR = GPIO_PIN_7<<16
#define PM_SDA_STS()		    (GPIOA->IDR&GPIO_PIN_7)

#define PM_SDA_IN()             PM_SDA_H()
#define PM_SDA_OUT()            do{}while(0)
    
//SEN
#define SEN_SCL_H()              GPIOA->BSRR = GPIO_PIN_10
#define SEN_SCL_L()              GPIOA->BSRR = GPIO_PIN_10<<16

#define SEN_SDA_H()              GPIOA->BSRR = GPIO_PIN_9
#define SEN_SDA_L()              GPIOA->BSRR = GPIO_PIN_9<<16
#define SEN_SDA_STS()		    (GPIOA->IDR&GPIO_PIN_9)

#define SEN_SDA_IN()             SEN_SDA_H()
#define SEN_SDA_OUT()            do{}while(0)
    
#define PRS_SCL_H()              GPIOB->BSRR = GPIO_PIN_0
#define PRS_SCL_L()              GPIOB->BSRR = GPIO_PIN_0<<16

//PUMP_CTL
#define PUMP_ON()               do{}while(0)
#define PUMP_OFF()              do{}while(0)

//HEAT_SW
#define HEAT_ON()               do{}while(0)
#define HEAT_OFF()              do{}while(0)


//SENSOR_BIAS_SW
#define SENSOR_BIAS_ON()        do{}while(0)
#define SENSOR_BIAS_OFF()       do{}while(0)

//SENSOR_BIAS_SEL
#define SENSOR_BIAS_High()      do{}while(0)
#define SENSOR_BIAS_Low()       do{}while(0)
    

//LS
#define LS_SCL_H()              while(0);
#define LS_SCL_L()              while(0);

#define LS_SDA_1_H()            do{}while(0)
#define LS_SDA_1_L()            do{}while(0)
#define LS_SDA_1_STS()		    0
#define LS_SDA_1_IN()           while(0);
#define LS_SDA_1_OUT()          while(0);

#define LS_SDA_2_H()            do{}while(0)
#define LS_SDA_2_L()            do{}while(0)
#define LS_SDA_2_STS()		    0
#define LS_SDA_2_IN()           while(0);
#define LS_SDA_2_OUT()          while(0);

#define PS_SCL_L()     			SEN_SCL_L()
#define PS_SCL_H()     			SEN_SCL_H()

#define PS0_SDA_IN     			SEN_SDA_IN()
#define PS0_SDA_OUT    			SEN_SDA_OUT()
#define PS0_SDA_L()    			SEN_SDA_L()
#define PS0_SDA_H()    			SEN_SDA_H()
#define PS0_SDA()      			SEN_SDA_STS()

//EPROM PB6
#define EPROM_H()               while(0);
#define EPROM_L()               while(0);
#define EPROM_IN()              while(0);
#define EPROM_OUT()             while(0);

//ENC
//ENC_CS
#define ENC_CS_H()              while(0);
#define ENC_CS_L()              while(0);

//ENC_CLK 
#define ENC_SCLK_H()            while(0);
#define ENC_SCLK_L()            while(0);

//ENC_DO
#define ENC_MISO()				0

#elif DEV_TYPE == DEV_TYPE_OXYGEN_STD     //Oxygen_Std

// Key
//power PB2
#define KEY_POWER_STS()			(GPIOB->IDR&GPIO_PIN_2)

//run_UP PC9
#define KEY_UP_PLAY_STS()		(GPIOC->IDR&GPIO_PIN_9)

//down 
#define KEY_DOWN_STS()			0

//BUS_link PC7
#define BUS_LINK_STS()			(GPIOC->IDR&GPIO_PIN_7)

//cjarhe_sts PC6
#define CHARGE_STS()            (GPIOC->IDR&GPIO_PIN_6)

//SYS_POWER_ON
#define SYS_POWER_ON()			GPIOA->BSRR = GPIO_PIN_10
#define SYS_POWER_OFF()			GPIOA->BSRR = GPIO_PIN_10<<16

//WL_POWER_ON
#define WL_POWER_ON()			GPIOA->BSRR = GPIO_PIN_9
#define WL_POWER_OFF()			GPIOA->BSRR = GPIO_PIN_9<<16

//LCD
#define OLED_SCL_Clr()          do{}while(0)
#define OLED_SCL_Set()          do{}while(0)

#define OLED_SDA_Clr()          do{}while(0)
#define OLED_SDA_Set()          do{}while(0)

#define OLED_RES_Clr()          do{}while(0)
#define OLED_RES_Set()          do{}while(0)

#define OLED_DC_Clr()           do{}while(0)
#define OLED_DC_Set()           do{}while(0)
 		     
#define OLED_CS_Clr()           do{}while(0)
#define OLED_CS_Set()           do{}while(0)


//LED
#define LED_RUN_B_ON()			do{ws2812_display_bit(2,LED_BIT_B,25);}while(0)
#define LED_RUN_B_OFF()			do{ws2812_display_bit(2,LED_BIT_B,0);}while(0)

#define LED_RUN_G_ON()			do{ws2812_display_bit(2,LED_BIT_G,25);}while(0)
#define LED_RUN_G_OFF()			do{ws2812_display_bit(2,LED_BIT_G,0);}while(0)

#define LED_RUN_R_ON()			do{ws2812_display_bit(2,LED_BIT_R,25);}while(0)
#define LED_RUN_R_OFF()			do{ws2812_display_bit(2,LED_BIT_R,0);}while(0)

#define LED_SYS_R_ON()			do{ws2812_display_bit(0,LED_BIT_R,25);}while(0)
#define LED_SYS_R_OFF()			do{ws2812_display_bit(0,LED_BIT_R,0);}while(0)

#define LED_SYS_G_ON()			do{ws2812_display_bit(0,LED_BIT_G,25);}while(0)
#define LED_SYS_G_OFF()			do{ws2812_display_bit(0,LED_BIT_G,0);}while(0)
    

#define LED_BLE_B_ON()			do{ws2812_display_bit(1,LED_BIT_B,25);}while(0)
#define LED_BLE_B_OFF()			do{ws2812_display_bit(1,LED_BIT_B,0);}while(0)

#define LED_BLE_R_ON()			do{ws2812_display_bit(1,LED_BIT_R,25);}while(0)
#define LED_BLE_R_OFF()			do{ws2812_display_bit(1,LED_BIT_R,0);}while(0)

//PUMP_CTL PB9
#define PUMP_ON()               GPIOB->BSRR = GPIO_PIN_9
#define PUMP_OFF()              GPIOB->BSRR = GPIO_PIN_9<<16

//HEAT_SW PC13
#define HEAT_ON()               GPIOC->BSRR = GPIO_PIN_13
#define HEAT_OFF()              GPIOC->BSRR = GPIO_PIN_13<<16

//SENSOR_BIAS_SW PC8
#define SENSOR_BIAS_ON()        GPIOC->BSRR = GPIO_PIN_8<<16
#define SENSOR_BIAS_OFF()       GPIOC->BSRR = GPIO_PIN_8

//SPI - memory
//CS PB12
#define W25X_CS_H()             GPIOB->BSRR = GPIO_PIN_12
#define W25X_CS_L()             GPIOB->BSRR = GPIO_PIN_12<<16
#define CS_STATUS()             (GPIOB->IDR&GPIO_PIN_12)

//MEAS CS PA6
#define ADS_CS_1_H()            GPIOA->BSRR = GPIO_PIN_6
#define ADS_CS_1_L()            GPIOA->BSRR = GPIO_PIN_6<<16

#define ADS_CS_2_H()           	GPIOA->BSRR = GPIO_PIN_7
#define ADS_CS_2_L()            GPIOA->BSRR = GPIO_PIN_7<<16

#define ADS_CS_3_H()            GPIOC->BSRR = GPIO_PIN_5
#define ADS_CS_3_L()            GPIOC->BSRR = GPIO_PIN_5<<16

#define ADS_CS_4_H()            while(0);
#define ADS_CS_4_L()            while(0);

#define ADS_CS_5_H()           	while(0);
#define ADS_CS_5_L()            while(0);

#define ADS_CS_6_H()            while(0);
#define ADS_CS_6_L()            while(0);

#define ADS_CS_7_H()            while(0);
#define ADS_CS_7_L()            while(0);

#define ADS_CS_8_H()            while(0);
#define ADS_CS_8_L()            while(0);

//MEAS spi
//CS_SENSOR PA4
#define SEN_CS_H()              GPIOA->BSRR = GPIO_PIN_4
#define SEN_CS_L()              GPIOA->BSRR = GPIO_PIN_4<<16

//CS_ACC PC3
#define ACC_CS_H()              GPIOC->BSRR = GPIO_PIN_3
#define ACC_CS_L()              GPIOC->BSRR = GPIO_PIN_3<<16

//SCLK PA0
#define ADS_SCLK_H()            GPIOA->BSRR = GPIO_PIN_0
#define ADS_SCLK_L()            GPIOA->BSRR = GPIO_PIN_0<<16
//MOSI PA1
#define ADS_MOSI_H()            GPIOA->BSRR = GPIO_PIN_1
#define ADS_MOSI_L()            GPIOA->BSRR = GPIO_PIN_1<<16
//MISO PA5
#define ADS_MISO()				(GPIOA->IDR&GPIO_PIN_5)

//PM SCL PB0
#define PM_SCL_H()              GPIOB->BSRR = GPIO_PIN_0
#define PM_SCL_L()              GPIOB->BSRR = GPIO_PIN_0<<16

//PM SDA PB1
#define PM_SDA_H()              GPIOB->BSRR = GPIO_PIN_1
#define PM_SDA_L()              GPIOB->BSRR = GPIO_PIN_1<<16
#define PM_SDA_STS()		    (GPIOB->IDR&GPIO_PIN_1)


#define PM_SDA_IN()             PM_SDA_H()
#define PM_SDA_OUT()            do{}while(0)


//LS
#define LS_SCL_H()              do{}while(0)
#define LS_SCL_L()              do{}while(0)

#define LS_SDA_1_H()            do{}while(0)
#define LS_SDA_1_L()            do{}while(0)
#define LS_SDA_1_STS()		    0
#define LS_SDA_1_IN()           do{}while(0)
#define LS_SDA_1_OUT()          do{}while(0)

#define LS_SDA_2_H()            do{}while(0)
#define LS_SDA_2_L()            do{}while(0)
#define LS_SDA_2_STS()		    0
#define LS_SDA_2_IN()           do{}while(0)
#define LS_SDA_2_OUT()          do{}while(0)

#define PS_SCL_L()     			while(0)
#define PS_SCL_H()     			while(0)

#define PS0_SDA_IN     			while(0)
#define PS0_SDA_OUT    			while(0)
#define PS0_SDA_L()    			while(0)
#define PS0_SDA_H()    			while(0)
#define PS0_SDA()      			0

//EPROM PB6
#define EPROM_H()               do{}while(0)
#define EPROM_L()               do{}while(0)
#define EPROM_IN()              do{}while(0)
#define EPROM_OUT()             do{}while(0)

//ENC
//ENC_CS
#define ENC_CS_H()              while(0);
#define ENC_CS_L()              while(0);
//ENC_CLK 
#define ENC_SCLK_H()            while(0);
#define ENC_SCLK_L()            while(0);
//ENC_DO
#define ENC_MISO()				0


#elif DEV_TYPE == DEV_TYPE_RPT_STD

// Key
//power PB7
#define KEY_POWER_STS()			(GPIOB->IDR&GPIO_PIN_7)

//run_UP PB8
#define KEY_UP_PLAY_STS()		(GPIOB->IDR&GPIO_PIN_8)
//down  PB6
#define KEY_DOWN_STS()			(GPIOB->IDR&GPIO_PIN_6)

//BUS_link PA5
#define BUS_LINK_STS()			(GPIOA->IDR&GPIO_PIN_5)

//Charge status PA3
#define CHARGE_STS()            (GPIOA->IDR&GPIO_PIN_3)

//SYS_POWER_ON PA4
#define SYS_POWER_ON()			GPIOA->BSRR = GPIO_PIN_4
#define SYS_POWER_OFF()			GPIOA->BSRR = GPIO_PIN_4<<16

//WL_POWER_ON PB3
#define WL_POWER_ON()			GPIOB->BSRR = GPIO_PIN_3
#define WL_POWER_OFF()			GPIOB->BSRR = GPIO_PIN_3<<16

//LCD PC3
#define OLED_SCL_Clr()          GPIOC->BSRR = GPIO_PIN_3<<16
#define OLED_SCL_Set()          GPIOC->BSRR = GPIO_PIN_3
//PA2
#define OLED_SDA_Clr()          GPIOA->BSRR = GPIO_PIN_2<<16
#define OLED_SDA_Set()          GPIOA->BSRR = GPIO_PIN_2
//PA0
#define OLED_RES_Clr()          GPIOA->BSRR = GPIO_PIN_0<<16
#define OLED_RES_Set()          GPIOA->BSRR = GPIO_PIN_0
//PA1
#define OLED_DC_Clr()           GPIOA->BSRR = GPIO_PIN_1<<16
#define OLED_DC_Set()           GPIOA->BSRR = GPIO_PIN_1
//PC2
#define OLED_CS_Clr()           GPIOC->BSRR = GPIO_PIN_2<<16
#define OLED_CS_Set()           GPIOC->BSRR = GPIO_PIN_2

//LED
#define LED_RUN_B_ON()			do{}while(0)
#define LED_RUN_B_OFF()			do{}while(0)

#define LED_RUN_G_ON()			do{}while(0)
#define LED_RUN_G_OFF()			do{}while(0)
    
#define LED_RUN_R_ON()			do{}while(0)
#define LED_RUN_R_OFF()			do{}while(0)

#define LED_SYS_R_ON()			do{}while(0)
#define LED_SYS_R_OFF()			do{}while(0)

#define LED_SYS_G_ON()			do{}while(0)
#define LED_SYS_G_OFF()			do{}while(0)

#define LED_BLE_B_ON()			do{}while(0)
#define LED_BLE_B_OFF()			do{}while(0)
    
#define LED_BLE_R_ON()			do{}while(0)
#define LED_BLE_R_OFF()			do{}while(0)

//PUMP_CTL
#define PUMP_ON()               do{}while(0)
#define PUMP_OFF()              do{}while(0)

//HEAT_SW
#define HEAT_ON()               do{}while(0)
#define HEAT_OFF()              do{}while(0)


//SPI - memory
//CS    
#define W25X_CS_H()             GPIOB->BSRR = GPIO_PIN_12
#define W25X_CS_L()             GPIOB->BSRR = GPIO_PIN_12<<16

//MEAS CS1  PB2
#define ADS_CS_1_H()            GPIOB->BSRR = GPIO_PIN_2
#define ADS_CS_1_L()            GPIOB->BSRR = GPIO_PIN_2<<16
//MEAS CS2  PB1
#define ADS_CS_2_H()           	GPIOB->BSRR = GPIO_PIN_1
#define ADS_CS_2_L()            GPIOB->BSRR = GPIO_PIN_1<<16

#define ADS_CS_3_H()            do{}while(0)
#define ADS_CS_3_L()            do{}while(0)

#define ADS_CS_4_H()            do{}while(0)
#define ADS_CS_4_L()            do{}while(0)
    
#define ADS_CS_5_H()            do{}while(0)
#define ADS_CS_5_L()            do{}while(0)

#define ADS_CS_6_H()           	do{}while(0)
#define ADS_CS_6_L()            do{}while(0)

#define ADS_CS_7_H()            do{}while(0)
#define ADS_CS_7_L()            do{}while(0)

#define ADS_CS_8_H()            do{}while(0)
#define ADS_CS_8_L()            do{}while(0)

//MEAS spi
//CS_SEN 
#define SEN_CS_H()              while(0);
#define SEN_CS_L()              while(0);

//CS_ACC
#define ACC_CS_H()              GPIOD->BSRR = GPIO_PIN_2
#define ACC_CS_L()              GPIOD->BSRR = GPIO_PIN_2<<16

//SCLK PC7
#define ADS_SCLK_H()            GPIOC->BSRR = GPIO_PIN_7
#define ADS_SCLK_L()            GPIOC->BSRR = GPIO_PIN_7<<16
//MOSI PC9
#define ADS_MOSI_H()            GPIOC->BSRR = GPIO_PIN_9
#define ADS_MOSI_L()            GPIOC->BSRR = GPIO_PIN_9<<16
//MISO PC8
#define ADS_MISO()				(GPIOC->IDR&GPIO_PIN_8)


//PM PA6
#define PM_SCL_H()              GPIOA->BSRR = GPIO_PIN_6
#define PM_SCL_L()              GPIOA->BSRR = GPIO_PIN_6<<16
// PA7
#define PM_SDA_H()              GPIOA->BSRR = GPIO_PIN_7
#define PM_SDA_L()              GPIOA->BSRR = GPIO_PIN_7<<16
#define PM_SDA_STS()		    (GPIOA->IDR&GPIO_PIN_7)

#define PM_SDA_IN()             PM_SDA_H()
#define PM_SDA_OUT()            do{}while(0)
    
//SEN
#define SEN_SCL_H()              do{}while(0)
#define SEN_SCL_L()              do{}while(0)

#define SEN_SDA_H()              do{}while(0)
#define SEN_SDA_L()              do{}while(0)
#define SEN_SDA_STS()		    do{}while(0)

#define SEN_SDA_IN()             SEN_SDA_H()
#define SEN_SDA_OUT()            do{}while(0)
    
//LED
#define LED_RUN_B_ON()			do{}while(0)
#define LED_RUN_B_OFF()			do{}while(0)

#define LED_RUN_G_ON()			do{}while(0)
#define LED_RUN_G_OFF()			do{}while(0)
    
#define LED_RUN_R_ON()			do{}while(0)
#define LED_RUN_R_OFF()			do{}while(0)

#define LED_SYS_R_ON()			do{}while(0)
#define LED_SYS_R_OFF()			do{}while(0)

#define LED_SYS_G_ON()			do{}while(0)
#define LED_SYS_G_OFF()			do{}while(0)

#define LED_BLE_B_ON()			do{}while(0)
#define LED_BLE_B_OFF()			do{}while(0)
    
#define LED_BLE_R_ON()			do{}while(0)
#define LED_BLE_R_OFF()			do{}while(0)

//PUMP_CTL
#define PUMP_ON()               do{}while(0)
#define PUMP_OFF()              do{}while(0)

//HEAT_SW
#define HEAT_ON()               do{}while(0)
#define HEAT_OFF()              do{}while(0)


//SENSOR_BIAS_SW
#define SENSOR_BIAS_ON()        do{}while(0)
#define SENSOR_BIAS_OFF()       do{}while(0)

//SENSOR_BIAS_SEL
#define SENSOR_BIAS_High()      do{}while(0)
#define SENSOR_BIAS_Low()       do{}while(0)
    

//LS
#define LS_SCL_H()              while(0);
#define LS_SCL_L()              while(0);

#define LS_SDA_1_H()            do{}while(0)
#define LS_SDA_1_L()            do{}while(0)
#define LS_SDA_1_STS()		    0
#define LS_SDA_1_IN()           while(0);
#define LS_SDA_1_OUT()          while(0);

#define LS_SDA_2_H()            do{}while(0)
#define LS_SDA_2_L()            do{}while(0)
#define LS_SDA_2_STS()		    0
#define LS_SDA_2_IN()           while(0);
#define LS_SDA_2_OUT()          while(0);

#define PS_SCL_L()     			while(0);
#define PS_SCL_H()     			while(0);

#define PS0_SDA_IN     			while(0);
#define PS0_SDA_OUT    			while(0);
#define PS0_SDA_L()    			while(0);
#define PS0_SDA_H()    			while(0);
#define PS0_SDA()      			0

//EPROM PB6
#define EPROM_H()               while(0);
#define EPROM_L()               while(0);
#define EPROM_IN()              while(0);
#define EPROM_OUT()             while(0);

//ENC
//ENC_CS PA8
#define ENC_CS_H()              GPIOA->BSRR = GPIO_PIN_8
#define ENC_CS_L()              GPIOA->BSRR = GPIO_PIN_8<<16

//ENC_CLK PA9
#define ENC_SCLK_H()            GPIOA->BSRR = GPIO_PIN_9
#define ENC_SCLK_L()            GPIOA->BSRR = GPIO_PIN_9<<16

//ENC_DO PA10
#define ENC_MISO()				(GPIOA->IDR&GPIO_PIN_10)

#else
#error
#endif

/* Exported macro ----------------------------------------------------------------------*/
/* Exported typedef --------------------------------------------------------------------*/
/* Exported variables ------------------------------------------------------------------*/
extern uint8_t eio_out_sts;
extern uint8_t test_plug;
/* Exported functions ------------------------------------------------------------------*/

void board_pins_init(void);

// //void LED_SYS_R_CTL(char s);
// //void LED_SYS_G_CTL(char s);
// //void LED_RUN_G_CTL(char s);
// //void LED_RUN_B_CTL(char s);
// //void LED_BLE_B_CTL(char s);

// //int KEY_POWER_S(void);
// //int KEY_UP_PLAY_S(void);
// //int KEY_DOWN_S(void);
// //void SYS_POWER_CTL(char s);
// //int BUS_LINK_S(void);
// //int BAT_CHARGE_S(void);

// #ifdef __cplusplus
// }
// #endif

#endif
/**********************************(C)COPYRIGHT 2016 Rsestudio **************************/
/*****************************************END OF FILE************************************/

